import {PipeTransform} from "../pipe-transform";
import {validate} from "../class-validator";

export class Validate implements PipeTransform {
  transform(value: any, dto: any) {
    const errors = validate(value, dto)

    if (errors.length > 0) {
      throw  { errors }
    }
  }
}